package com.kclm.mapper;

import com.kclm.pojo.Car;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author : lvhx
 * @Date: 2025/10/29 9:32
 * @Description:
 */
public interface CarMapper {
    @Select("select * from t_car where id=#{id}")
    Car  selectById(Integer id);
    @Select("select * from t_car")
    List<Car> selectAll();

    //根据id删除
    @Delete("delete from t_car where id=#{id}")
    int  deleteById(Integer id);

    //新增汽车信息
    @Insert("insert into  t_car(car_num,brand,guide_price ,produce_time,car_type)" +
            "values(#{carNum},#{brand},#{guidePrice},#{produceTime},#{carType})")
    int  insert(Car car);
    @Update("update t_car set car_num=#{carNum},brand=#{brand},guide_price=#{guidePrice}," +
            "produce_time=#{produceTime},car_type=#{carType} where id=#{id}")
    int  update(Car car);


}
